package com.cjm.one.webmanager.service.order.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.common.result.Result;
import com.cjm.one.model.base.PageVo;
import com.cjm.one.model.order.dto.OrderChartItem;
import com.cjm.one.model.order.dto.OrderNoRefundDto;
import com.cjm.one.model.order.entity.OrderInfo;
import com.cjm.one.model.order.enums.OrderStatusEnum;
import com.cjm.one.model.order.enums.PayTypeEnum;
import com.cjm.one.model.order.vo.OrderInfoVo;
import com.cjm.one.order.client.OrderInfoClient;
import com.cjm.one.webmanager.service.order.OrderInfoService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
@Slf4j
public class OrderInfoServiceImpl implements OrderInfoService {
    @Resource
    private OrderInfoClient orderInfoClient;

    @Override
    public Result<PageVo<OrderInfoVo>> list(Long current, Long size, Long userId, String orderNo, OrderStatusEnum status, PayTypeEnum payStatus, String userName, String createTimeStart, String createTimeEnd, String phone, String goodsName) {
        return orderInfoClient.list(current, size, userId, orderNo, status, payStatus, userName, createTimeStart, createTimeEnd, phone, goodsName);
    }

    @Override
    public Result<OrderInfoVo> getOrderInfo(Long id) {
        Result<OrderInfoVo> orderInfo = orderInfoClient.getOrderInfo(id);
        log.info("获取订单信息:{}",orderInfo);
        return orderInfo;
    }

    @Override
    public Result<Boolean> delete(Long id) {
        return orderInfoClient.delete(id);
    }

    @Override
    public Result<Boolean> deleteBatch(Long[] ids) {
        return orderInfoClient.deleteBatch(ids);
    }

    @Override
    public Result<Boolean> refund(Long id) {
        return orderInfoClient.refund(id);
    }

    @Override
    public Result<Boolean> updateStatus(Long id, OrderStatusEnum status) {
        return orderInfoClient.updateStatus(id, status);
    }

    @Override
    public Result<OrderStatusEnum> test() {

           return orderInfoClient.test();
    }

    @Override
    public Result<Boolean> noRefund(OrderNoRefundDto orderNoRefundDto) {
        return orderInfoClient.noRefund(orderNoRefundDto);
    }

    @Override
    public Result<Map<String, Object>> getOrderSummary(String timeRange) {
        return orderInfoClient.getOrderSummary(timeRange);
    }

    @Override
    public Result<List<OrderChartItem>> getOrderChart(String timeRange) {
        return orderInfoClient.getOrderChart(timeRange);
    }
}
